package com.ruoyi.web.contrller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.domain.Huishou;
import com.ruoyi.web.service.IHuishouService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 药品回收Controller
 */
@RestController
@RequestMapping("/warehouse/huishou")
public class HuishouController extends BaseController {
    @Autowired
    private IHuishouService huishouService;

    /**
     * 查询药品回收列表
     */
    @PreAuthorize("@ss.hasPermi('warehouse:huishou:list')")
    @GetMapping("/list")
    public TableDataInfo list(Huishou huishou)
    {
        startPage();
        List<Huishou> list = huishouService.selectHuishouList(huishou);
        return getDataTable(list);
    }

    /**
     * 删除药品回收
     */
    @PreAuthorize("@ss.hasPermi('warehouse:huishou:remove')")
    @Log(title = "药品回收", businessType = BusinessType.DELETE)
    @DeleteMapping("/{huishouids}")
    public AjaxResult remove(@PathVariable Long huishouids)
    {
        return toAjax(huishouService.deleteHuishouByHuishouId(huishouids));
    }
}
